namespace hjc {

	export abstract class System implements ISystem {

		protected $enabled: boolean = true;
		protected abstract $concerns: Array<(new (...params: any[]) => Component) | any>;
		public get concerns(): Array<(new (...params: any[]) => Component) | any> { return this.$concerns; }
		public get enabled(): boolean { return this.$enabled; }
		public set enabled(enabled: boolean) { this.$enabled = enabled; }
		public onFrame(param?: hjc.TimeParam): void { this.execute(this.entities(), param); }
		protected abstract execute(entities: Entity[], param: TimeParam): void;
		protected entities(): Entity[] {
			if (notEmptyArr(this.$concerns)) return game.entities().filter(entity => entity.has(...this.$concerns));
			else return [];
		}
	}
}